package com.ruoyi.common.utils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Random;

public class IdGenerator {

    public static  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");

    public static  DateTimeFormatter formatter_all = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

    public static String genId() {
        LocalDateTime now = LocalDateTime.now();
        String format = now.format(formatter);
        Random random = new Random();
        int i = random.nextInt(100000);
        String str = String.format("%06d", i);
        return format + str;
    }

//    public static void main(String[] args) {
//        System.out.println(genId());
//    }
}
